class Solution(object):
    def simplifyPath(self, path):
        """
        :type path: str
        :rtype: str
        """
        l = path.split('/')
        ret = []
        for p in l:
            if p=='.' or p=='': continue
            elif p=='..':
                if len(ret)!=0:
                    ret.pop()
            else:
                ret.append(p)
        return '/'+'/'.join(ret)

print(Solution().simplifyPath('/c'))